<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1 id="h11">这是一个大标题</h1>

    <div id="div1">
        <p id="p1">这是一个在div里的p</p>
    </div>

    <p>这是一个自由的p</p>
    <p>这是另一个自由的p</p>

    <div id="div2">
        一个div
    </div>

    <ul>
        <li>空调</li>
        <li>WIFI</li>
        <li id="ipone">手机</li>
        <li>吃饭</li>
    </ul>
    <script>
        let div1 = document.querySelector("#div1")
        console.log(div1)

        let divs = document.getElementsByTagName("div")

        let p1 = document.getElementById("p1")
        let myEle = document.createElement("h3")
        myEle.innerHTML = "我是插队的"
        let myEle2 = document.createElement("h3")
        myEle2.innerHTML = "我是让路的"

        p1.before(myEle)
        p1.after(myEle2)


        let ipone = document.getElementById("ipone")
        console.log(ipone)

        // 第一种
        // ipone.remove()
        // console.log(list)
        //第二种
        list[0].removeChild(list[0].children[2])
        console.log(list)
    </script>
</body>

</html>